home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / AdminAlertFunc2.js < prev    next >
Encoding:
JavaScript  |  2003-06-24  |  69.8 KB  |  1,878 lines

  1. /* ======================================================================
  2. DESC: Common Alert Functions for the Administer/Analyze Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5.  
  6. USAGE NOTES: 
  7. ====================================================================== */
  8.  
  9. // Process and Display the IP Services:Computer Tree
  10. function processServiceTree() {
  11.     Tid = null; // clear timeout ID
  12.     /* Format and Output Service tree list */
  13.     setOutHeader("IP Service : Server/Computer Tree"); // define output table header    
  14.     var SelT = "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  15.     SelT += "<tr><td width='100%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Selections</td></tr></table>";
  16.     CCEs = SelT+CCEs;
  17.  
  18.     for ( var i=0; i<ServicesArray.length; i++) {
  19.         CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='490'><tr><td width='25'> </td>";
  20.         Iprefx = ( i+1 >= ServicesArray.length ) ? "L" : "T";
  21.  
  22.         if ( ServicesArray[i] == curSrvcName ) {
  23.               CCEs += "<td width='19' align='center'><img id='sima" + i + "' expanded='0' src='images/" + Iprefx + "minus.gif' style='cursor:hand' onclick='procSrvImgClick(this)' width='19' height='20'></td>";
  24.             CurExpServIx = i; // Save Current Service Index
  25.         }
  26.         else {
  27.            CCEs += "<td width='19' align='center'><img id='sima" + i + "' expanded='0' src='images/" + Iprefx + "plus.gif' style='cursor:hand' onclick='procSrvImgClick(this)' width='19' height='20'></td>";
  28.         }
  29.         CCEs += "<td width='19' align='center'><img id='simb" + i + "' src='images/sAdminServers.gif' style='cursor:hand' onclick='procSrvImgClick(this)' width='16' height='16' title='";
  30.         CCEs += "'></td><td width='*' class='optext'>" + ServicesArray[i] + "</td></tr></table>";
  31.         CCEs += "<div id='sexp" + i + "' compcount='0' compchkcount='0'></div>";
  32.       }
  33.     AL_CCOneServ.insertAdjacentHTML("beforeEnd",CCEs);
  34.     if ( ALMode == "New" ) {
  35.         SrvcHint.style.visibility ="visible";
  36.         SetButtonState(UUpdateButton,"0");
  37.         SetButtonState(UResetButton,"0");
  38.     }
  39.     SrvcHint.style.visibility ="visible";
  40.     /* If a Service is Expanded, Initiate processing for Its Associated Computers */
  41.     if ( curSrvcName != null ) { // Expand Service
  42.         procSrvImgClick(document.all["sima"+CurExpServIx]);
  43.     }
  44.     else {
  45.         SetButtonState(UUpdateButton,"0");
  46.         SetButtonState(UResetButton,"0");
  47.     }
  48. }
  49.  
  50. // Process and Display the Object:Counter:Computer Tree
  51. var ObjTreeIndex = 0;
  52. var OCCEstrg = "";
  53. function processAATree() {
  54.     Tid = null; // clear timeout ID
  55.     /* Format and Output Object tree list */
  56.     setOutHeader("Object : Counter : Server/Computer Tree"); // define output table header    
  57.     var SelT = "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  58.     SelT += "<tr><td width='100%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Selections</td></tr></table>";
  59.     OCCEstrg = SelT+CCEs;
  60.     ObjTreeIndex = 0;
  61.     if ( ALMode == "New" || ALMode == "Edit") {
  62.         CounterHint.style.visibility ="visible";
  63.     }
  64.     SetCursor("wait");
  65.     top.banner.processStartComm();
  66.     processObjectTreeOutput();
  67. }
  68. function processObjectTreeOutput() {
  69.     Tid = null;
  70.     var i = ObjTreeIndex;
  71.     var j = ObjTreeIndex * ObjectRecLength;
  72.     var loopcount = 0;
  73.     for ( ; i<ObjectLupRecCount && loopcount < 25; loopcount++, i++, j+=ObjectRecLength) {
  74.         OCCEstrg += "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  75.         OCCEstrg += "<tr><td width='25'> </td>";
  76.         
  77.         if ( LastObjectName == AL_OCStoreArr[j] ) { // if last Object
  78.            Iprefx = "L";
  79.          }    
  80.         else {
  81.            Iprefx = "T";
  82.         }
  83.  
  84.         if ( AL_OCStoreArr[j] == CurObjName ) {
  85.               OCCEstrg += "<td width='19' align='center'><img id='oima" + i + "' expanded='1' src='images/" + Iprefx + "minus.gif' style='cursor:hand' onclick='procObImgClick(this)' width='19' height='20'></td>";
  86.             CurObjIx = i; // Save Current Object Index
  87.         }
  88.         else {
  89.            OCCEstrg += "<td width='19' align='center'><img id='oima" + i + "' expanded='0' src='images/" + Iprefx + "plus.gif' style='cursor:hand' onclick='procObImgClick(this)' width='19' height='20'></td>";
  90.         }
  91.         OCCEstrg += "<td width='19' align='center'><img id='oimb" + i + "' src='images/Objects.gif' style='cursor:hand' onclick='procObImgClick(this)' width='16' height='16' title='";
  92.         Odsc = AL_OCStoreArr[j+1]; // get description
  93.         if ( Odsc.charAt(0) == "{" ) { // if instance
  94.             var k = j; // get/preserve Object index
  95.             while ( (k-=ObjectRecLength) >= 0 ) { // find decription for the instance
  96.                 if ( AL_OCStoreArr[k+1] == Odsc ) {
  97.                     continue; // if another instance
  98.                 }
  99.                 else {
  100.                     Odsc = AL_OCStoreArr[k+1];
  101.                     break;
  102.                 }                            
  103.             } // end While
  104.        }
  105.         OCCEstrg += Odsc + "'></td>";
  106.         OCCEstrg += "<td width='*' class='optext'>" + AL_OCStoreArr[j] + "</td>";
  107.         OCCEstrg += "</tr></table>";
  108.         OCCEstrg += "<div id='oexp" + i + "' cntrcount='0'></div>";
  109.       }
  110.     AL_CCOne.insertAdjacentHTML("beforeEnd",OCCEstrg);
  111.     ObjTreeIndex = i;
  112.     OCCEstrg = "";
  113.     if ( i >= ObjectLupRecCount ) {
  114.             Tid = setTimeout("processObjectTreeOutputDone()",50); // delay 50 ms. then process Tree           
  115.     }
  116.     else {
  117.             Tid = setTimeout("processObjectTreeOutput()",50); // delay 50 ms. then process Tree           
  118.     }
  119. }
  120. function processObjectTreeOutputDone() {
  121.     Tid = null;
  122.     /* If an Object is Expanded, Initiate Read for its Counters */
  123.     if ( CurObjName != "") { // Expand Object
  124.         /* Lookup Counter Name and Description */
  125.         //CLOs = getObjIDArr(CurObjIx);
  126.         var Wrk = new Array();
  127.         var OCA = AL_OCStoreArr[(ObjectRecLength*CurObjIx)+2].split(";"); //ObjID,CmpID 
  128.         Wrk = OCA[0].split(","); // get Object ID from pair of "ObjID,CompID"
  129.         if ( RpmCC_AL.CounterLookupForObjCntrArray("ObjectID,"+Wrk[0]) ) {
  130.             ALupMode = "";
  131.             top.Rstatus.Pstat("Unable to start the Counter lookup request",true);
  132.         }
  133.         else {
  134.             CCEs = ""; // initialize output string and counter
  135.             CurCntrIx = 0; 
  136.              ALupMode = "CounterLookupEdit"; // set Mode of operation
  137.             top.Rstatus.Pstat("One moment while Counter lookup request completes");
  138.         }
  139.     }
  140.     else {
  141.         SetCursor("auto");
  142.           top.banner.processStopCommX();
  143.         SetButtonState(UUpdateButton,"0");
  144.         SetButtonState(UResetButton,"0");
  145.     }
  146. }
  147.  
  148. /* Process Click on Service in Service Tree */
  149. var CurExpServIx = null; // Index to Current Expanded Service
  150. var CmpAgrpIdAr = new Array();
  151. function procSrvImgClick(SIm) {
  152.     isx = SIm.id;  
  153.     if ( isx.charAt(0) != "s" || ALupMode != "" ) // if not a "simaxx"
  154.                 return;
  155.     var cx = isx.substring(4,isx.length); // Strip off index
  156.  
  157.     // Close current expanded service first
  158.     CObj = document.all["sima"+CurExpServIx];
  159.     EObj = document.all["sexp"+CurExpServIx];
  160.     if ( CObj.expanded == "1" ) { // if currently expanded
  161.        if (EObj.compchkcount != 0) { // Are computers checked?
  162.            alert("You currently have one or more servers/devices selected for the expanded IP Service.\nReset these first before expanding another IP Service and selecting its servers/devices.");
  163.             return;
  164.        }
  165.         Cpfx = (CurExpServIx+1 >= ServicesArray.length) ? "L" : "T";
  166.         CObj.src = "images/" + Cpfx + "plus.gif";
  167.         EObj.style.display = "none";
  168.         EObj.innerHTML = ""; // Contract 
  169.        CObj.expanded = "0"; // Set contracted
  170.           LastCmpSelectedSuffix = null;
  171.           CmpsSelectedCount = 0; // reset count
  172.           if ( CObj ==  document.all["sima"+cx]) {
  173.            return;
  174.         }
  175.     }
  176.  
  177.     CurExpServIx = parseInt(cx,10);
  178.     CObj = document.all["sima"+cx];
  179.     EObj = document.all["sexp"+cx];
  180.     Cpfx = (CurExpServIx+1 >= ServicesArray.length) ? "L" : "T";
  181.  
  182.     if ( CObj.expanded == "1" ) { // if currently expanded
  183.         CObj.src = "images/" + Cpfx + "plus.gif";
  184.         EObj.style.display = "none";
  185.         EObj.innerHTML = ""; // Contract 
  186.        CObj.expanded = "0"; // Set contracted
  187.        if (EObj.compchkcount != 0) { // Are computers checked?
  188.            LastCmpSelectedSuffix = null;
  189.            CmpsSelectedCount = 0; // reset count
  190.        }
  191.      }
  192.     else { // otherwise Expand
  193.         CObj.src = "images/" + Cpfx + "minus.gif";
  194.        CObj.expanded = "1"; // Set expanded
  195.        // Create Array of Computers for this Selected Service
  196.        CIDArr = ""; // initialize Array
  197.        SType = ServicesArray[CurExpServIx]; // Service Type
  198.        
  199.        if ( SType == "AGENT" ) {
  200.            AgentOptions.style.visibility = "visible";
  201.         }
  202.         else {
  203.            AgentOptions.style.visibility = "hidden";
  204.         }
  205.  
  206.         CmpAgrpIdAr.length = 0; // reset
  207.        for ( var i=0,j=0,k=0; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) {
  208.            if ( AC_ServicesStoreArr[i+2] == SType ) {
  209.                if ( CIDArr != "" ) { 
  210.                    CIDArr += ","; 
  211.                }   
  212.                   CIDArr += AC_ServicesStoreArr[i]; // Add Computer ID
  213.                   CmpAgrpIdAr[k++] = AC_ServicesStoreArr[i]; // save CompID Value 
  214.                   CmpAgrpIdAr[k++] = AC_ServicesStoreArr[i+1]; // save associated AGrpID Value 
  215.                   ++j; // bump computer count
  216.            }
  217.         }
  218.         ALupMode = ""; // reset mode
  219.         if ( (CmpsExpected = j) == 0 ) {
  220.             top.Rstatus.Pstat("No Servers/Devices defined for "+SType+" Service");
  221.         }
  222.         else {
  223.             /* Lookup Computer Names and Descriptions */
  224.             if ( RpmCC_AL.ComputerLookupByIDArray(CIDArr) ) {
  225.                 top.Rstatus.Pstat("Unable to start the Computer lookup request",true);
  226.             }
  227.             else {
  228.                 CCEs = "";
  229.                  CurCmpIx = 0;
  230.                 ALupMode = "SrvComputerLookupEdit"; // set Mode of operation
  231.                 top.Rstatus.Pstat("One moment while lookup request completes");
  232.             }
  233.         }
  234.     }
  235. }
  236. function processEditSrvComputer(CmpNme,CmpDesc,CID) {
  237.     Opfx = (CurExpServIx+1 >= ServicesArray.length) ? "White" : "I";
  238.     Mpfx = (CurCmpIx+1 == CmpsExpected) ? "L" : "T";
  239.     
  240.     CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  241.     CCEs += "<tr><td width='25'> </td><td width='19' height='20' align='center'><img src='images/" + Opfx + ".gif' width='19' height='20'></td>";
  242.     CCEs += "<td width='19' height='20' align='center'><img src='images/" + Mpfx + ".gif' width='19' height='20'></td>";
  243.  
  244.     var CimgSel = "Computer.gif";// preset
  245.     if ( IsCompChked(CID) ) {
  246.        CCEs += "<td width='11' align='center'><img id='vima" + CurExpServIx + "_" + CurCmpIx;
  247.        CCEs += "' checked='1' src='images/Checked.gif' compid='" + CID;
  248.        CCEs += "' inuse='0' style='cursor:hand' onclick='procCmpImgClick(this)' width='9' height='9'></td>";
  249.          CimgSel = selectImage;
  250.        LastCmpSelectedSuffix = CurExpServIx; // Save as last selected suffix
  251.        ++CmpsSelectedCount; // Bump count of selected computers
  252.     }
  253.     else {
  254.         var CmpImg = "Unchecked.gif' width='9' height='9'"; var inuseflg = "0"; var clkHnd = "procCmpImgClick(this)"; // preset available
  255.         for ( var i=0; i<CmpAgrpIdAr.length; i+=2 ) {
  256.            if ( CmpAgrpIdAr[i] == CID ) { // if match on Computer ID
  257.                if ( CmpAgrpIdAr[i+1] != 0 && CmpAgrpIdAr[i+1] != curAGRPID ) {
  258.                     CmpImg = "sAdminAlerts.gif' width='16' height='16'"; inuseflg = "1' title='Assigned to Watch: "+getOnlyAlertName(CmpAgrpIdAr[i+1]);
  259.                     clkHnd = "procDoNothing()"; // no click handler
  260.                 }
  261.                 break;
  262.             }
  263.          }
  264.        CCEs += "<td width='11' align='center'><img id='vima" + CurExpServIx + "_" + CurCmpIx;
  265.        CCEs += "' checked='0' src='images/" + CmpImg + " compid='" + CID;
  266.        CCEs += "' inuse='" + inuseflg + "' style='cursor:hand' onclick='" + clkHnd + "'></td>";
  267.     }
  268.     CCEs += "<td width='19' align='center'><img id='pimb" + CurExpServIx + "_" + CurCmpIx + "' src='images/"+CimgSel+"' style='cursor:hand' onclick='" + clkHnd + "' width='14' height='16' title='";
  269.     CCEs += CmpDesc + "'></td>";
  270.     CCEs += "<td width='*' class='optext'>" + CmpNme + "</td>";
  271.     CCEs += "</tr></table>";
  272.     ++CurCmpIx; // bump index
  273. }
  274.  
  275. /* Read of Computers complete; Output formatted Computers */
  276. function processEditSrvComputerComplete() {
  277.     EObj = document.all["sexp"+CurExpServIx];
  278.     EObj.insertAdjacentHTML("beforeEnd",CCEs);
  279.     EObj.style.display = "";
  280.     EObj.compcount = CurCmpIx; // Count of Computers
  281.     EObj.compchkcount = CkCArr.length; // Count of checked computers
  282.     document.all["sima"+CurExpServIx].scrollIntoView(true);
  283.     CkCArr.length = 0; // reset Checked computer array
  284.     ALupMode = "";
  285.     top.Rstatus.Pstat("Request Completed");
  286.     if (ALMode == "Edit") {
  287.         SetButtonState(UUpdateButton,"0");
  288.         SetButtonState(UResetButton,"0");
  289.     }
  290. }
  291.  
  292. /* Compute an ObjectID string array from the ObjId,CompID array in the Store */
  293. function getObjIDArr(COix) {
  294.     var Wrk0 = new Array();
  295.     var OCA = AL_OCStoreArr[(ObjectRecLength*COix)+2].split(";"); //ObjID,CmpID 
  296.     /* Compute Array of Computer IDs */
  297.     var scid = ""; // Object ID Array
  298.     var smax = --OCA.length; // adjust for null last entry
  299.     for ( var i=0; i<smax; i++ ) {
  300.         Wrk0 = OCA[i].split(","); // get Object ID from pair of "ObjID,CompID"
  301.         if ( i > 0) {
  302.            scid += ","; // array id separator
  303.         }
  304.         scid += Wrk0[0];
  305.     }
  306.     return scid;
  307. }
  308.  
  309. var CmpsExpected = 0; // number of computers in the array being looked up //
  310. /* Process Counter's ComputerID Array; Initiate Read for Computer Info */
  311. function processCompIDs(CntrNme,CIDArr) {
  312.     var fArr = new Array();
  313.     var tArr = new Array();
  314.     var oca = "";
  315.     /* weed out duplicate Computer IDs */
  316.     fArr = CIDArr.split(",");
  317.     fP = null; // previous
  318.     for ( var i=0, j=0; i<fArr.length-1; i+=3 ) {
  319.         if ( fArr[i] !=  fP) { // if not duplicate, add to ToArray
  320.            fP = fArr[i]; // set new previous
  321.            tArr[j++] = fP;
  322.            oca += fArr[i+1]+","+fArr[i+2]+";";
  323.        }
  324.    }
  325.    // Update the ObjId,CntrID array in the Counter display
  326.    document.all["cima"+CurExpCntrIx].ocarray = oca;
  327.     CmpsExpected = tArr.length-1;
  328.     CIDArr = tArr.join(","); // form array string
  329.     /* Lookup Computer Names and Descriptions */
  330.     if ( RpmCC_AL.ComputerLookupByIDArray(CIDArr) ) {
  331.         ALupMode = "";
  332.         top.Rstatus.Pstat("Unable to start the Computer lookup request",true);
  333.     }
  334.     else {
  335.         CCEs = "";
  336.         CurCmpIx = 0;
  337.         ALupMode = "ComputerLookupEdit"; // set Mode of operation
  338.         top.Rstatus.Pstat("One moment while lookup request completes");
  339.     }
  340. }
  341.  
  342. /* Process Read of Computers; Format One line of Computer Output*/
  343. function processEditComputer(CmpNme,CmpDesc,CID) {
  344.     Opfx = (CurObjName == LastObjectName) ? "White" : "I";
  345.     Cpfx = (CurExpCntrIx == CurObjIx + "_" + (CurCntrIx-1)) ? "White" : "I";
  346.     Mpfx = (CurCmpIx == CmpsExpected) ? "L" : "T";
  347.     
  348.     CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='490'>";
  349.     CCEs += "<tr><td width='25'> </td><td width='19' height='20' align='center'><img src='images/" + Opfx + ".gif' width='19' height='20'></td>";
  350.     CCEs += "<td width='19' height='20' align='center'><img src='images/" + Cpfx + ".gif' width='19' height='20'></td>";
  351.     CCEs += "<td width='19' height='20' align='center'><img src='images/" + Mpfx + ".gif' width='19' height='20'></td>";
  352.  
  353.     var CimgSel = "Computer.gif";// preset
  354.     if ( IsCompChked(CID) ) {
  355.        CCEs += "<td width='11' align='center'><img id='pima" + CurExpCntrIx + "_" + CurCmpIx;
  356.        CCEs += "' checked='1' src='images/Checked.gif' compid='" + CID;
  357.        CCEs += "' style='cursor:hand' onclick='procCmpImgClick(this)' width='9' height='9'></td>";
  358.        CimgSel = selectImage;
  359.        LastCmpSelectedSuffix = CurExpCntrIx; // Save as last selected suffix
  360.        ++CmpsSelectedCount; // Bump count of selected computers
  361.     }
  362.     else {
  363.        CCEs += "<td width='11' align='center'><img id='pima" + CurExpCntrIx + "_" + CurCmpIx;
  364.        CCEs += "' checked='0' src='images/Unchecked.gif' compid='" + CID;
  365.        CCEs += "' style='cursor:hand' onclick='procCmpImgClick(this)' width='9' height='9'></td>";
  366.     }
  367.     CCEs += "<td width='19' align='center'><img id='pimb" + CurExpCntrIx + "_" + CurCmpIx + "' src='images/"+CimgSel+"' style='cursor:hand' onclick='procCmpImgClick(this)' width='14' height='16' title='";
  368.     CCEs += CmpDesc + "'></td>";
  369.     CCEs += "<td width='*' class='optext'>" + CmpNme + "</td>";
  370.     CCEs += "</tr></table>";
  371.     ++CurCmpIx; // bump index
  372. }
  373.  
  374. /* Determine if Specified Computer Should Be Checked */
  375. function IsCompChked(Cd) {
  376.     for ( var i=0; i<CkCArr.length; i++ ) {
  377.        if ( Cd == CkCArr[i] ) {
  378.            return true; 
  379.        } 
  380.     }
  381.     return false;
  382. }
  383.  
  384. /* Read of Computers complete; Output formatted Computers */
  385. function processEditComputerComplete() {
  386.     EObj = document.all["cexp"+CurExpCntrIx];
  387.     EObj.insertAdjacentHTML("beforeEnd",CCEs);
  388.     EObj.style.display = "";
  389.     EObj.compcount = CurCmpIx; // Count of Computers
  390.     EObj.compchkcount = CkCArr.length; // Count of checked computers
  391.     document.all["cima"+CurExpCntrIx].scrollIntoView(true);
  392.     CkCArr.length = 0; // reset Checked computer array
  393.     ALupMode = "";
  394.     SetCursor("auto");
  395.       top.banner.processStopCommX();
  396.     top.Rstatus.Pstat("Request Completed");
  397.     if (ALMode == "Edit" || DuplicateFlag) {
  398.         SetButtonState(UUpdateButton,"0");
  399.         SetButtonState(UResetButton,"0");
  400.     }
  401. }
  402.  
  403.  
  404. /* Uncheck computers from previous Counter */
  405. function goResetSelectedComps(dp,cp) {
  406.     var dx = LastCmpSelectedSuffix;
  407.     FObj = document.all[dp+"exp"+dx]; // DIV containing other selected computers
  408.     
  409.     for ( var i=0; i<FObj.compcount; i++ ) {
  410.         CmpObj = document.all[cp+"ima"+dx+"_"+i]; 
  411.         CmpObjImg = document.all["pimb"+dx+"_"+i];
  412.         if ( CmpObj.checked == "1" ) {
  413.             CmpObj.src = "images/Unchecked.gif";
  414.            CmpObj.checked = "0"; // Set Unchecked
  415.            CmpObjImg.src = "images/Computer.gif";
  416.         }
  417.     }
  418.    FObj.compchkcount = 0; // clear count of computers checked
  419.    CmpsSelectedCount = 0;
  420.    LastCmpSelectedSuffix = null;
  421. }
  422.  
  423. /* Create Array of Service Computers */
  424. var SrvCIDArr = ""; 
  425. function createServiceIDArray() {
  426.     SrvCIDArr = ""; // default no computers selected
  427.     var cx = LastCmpSelectedSuffix;
  428.     if (cx == null) {
  429.         return false;
  430.     }
  431.     curSrvcName = ServicesArray[cx]; // get current Service type
  432.     /* Create an array of selected computers */
  433.     CXObj = document.all["sexp"+cx]; // DIV object for Computer expansion
  434.     for ( var i=0, j=0; i<CXObj.compcount; i++ ) { // Test each computer for Checked
  435.         if ( document.all["vima"+cx+"_"+i].checked == "1" ) {
  436.             if ( SrvCIDArr != "" ) { // if not first, add comma separator
  437.                 SrvCIDArr += ",";
  438.             }
  439.             SrvCIDArr += document.all["vima"+cx+"_"+i].compid; // save Computer ID
  440.         }
  441.     }
  442.     if ( SrvCIDArr == "" ) 
  443.         return false;
  444.     else
  445.        return true;
  446. }
  447.  
  448. var Tops = ""; // output string
  449. var OObj = null; // Object output
  450. var OCArray = new Array(); // ComputerID,ObjectID pair array
  451. var CkCArr = new Array(); // "Checked" Computers array
  452. var curAGRPID = null; // Current Alert Grp ID selected
  453. var curSrvcName = null; // Current Service Name selected
  454. var PINP_Bsy = false;
  455. var AGerr = false; // Alert Group error flag
  456. function populateInput(idx) {
  457.     AGerr = false;
  458.     PINP_Bsy = true;
  459.     var srvcarr = new Array();
  460.     var wnarr = new Array();
  461.     var wrk = new Array();
  462.     var pwrka = new Array();
  463.     
  464.     curAGRPID = AlertStoreArr[idx+1]; // Alert Group ID
  465.     AL_Alert.value = AlertStoreArr[idx+0]; // Synchronize name field with Store name field
  466.     AL_Desc.value = (AlertStoreArr[idx+2].length == 0) ? "" : AlertStoreArr[idx+2];
  467.     AL_Thrsh.value = (AlertStoreArr[idx+3].length == 0) ? "" : AlertStoreArr[idx+3];
  468.     AL_TUnder.checked = (AlertStoreArr[idx+4] == "1") ? "checked" : "";
  469.     AL_EveryT.checked = (AlertStoreArr[idx+5] == "1") ? "checked" : "";
  470.     AL_Dur.value = (AlertStoreArr[idx+6].length == 0) ? "" : AlertStoreArr[idx+6];
  471.  
  472.     /* Determine Schedule */
  473.     var Ia = new Array();
  474.     var i = (AlertStoreArr[idx+7].length == 0) ? "" : AlertStoreArr[idx+7];
  475.     Ia = i.split(",");
  476.     if ( (CDCount = Ia[1]) != 0 ) {
  477.         CDUnits = 2; // default to hours
  478.     }
  479.     else {
  480.         if ( (CDCount = Ia[3]) == 0 ) {
  481.             ++CDCount;
  482.         }
  483.         CDUnits = Ia[2];
  484.     }
  485.     AL_Sched.value = " " + CDCount + " " + SchedTxtArray[CDUnits];
  486.  
  487.     // Determine Severity
  488.     var Sev = AlertStoreArr[idx+23];
  489.     pwrka = Sev.split("]["); // parse out Severity
  490.     var SevDefault = ( pwrka.length > 5 ) ? false : true;;
  491.     AL_WASeveritySel.selectedIndex = ( pwrka.length > 5 ) ? parseInt(pwrka[5],10) : 1;
  492.     AL_WASeverity.value = SeverityArray[ AL_WASeveritySel.selectedIndex ];
  493.     pwrka.length = 0; // reset
  494.     
  495.     // If Counter Type, get Computers,Object,Counter (COC) to an Array
  496.     OCIx = 0; // initialize index
  497.     OCArray.length = 0;
  498.     if ( AlertStoreArr[idx+10] != "" && AlertStoreArr[idx+10].length > 1 ) {
  499.        OCArray = AlertStoreArr[idx+10].split(";"); 
  500.    }
  501.     var StartDT = (AlertStoreArr[idx+8].length == 0) ? "" : AlertStoreArr[idx+8];
  502.     if ( StartDT == "01/01/1999 11:30:00" || StartDT == "1/1/1999 11:30:0" ) { // Service type
  503.         CurrentAT = ServiceType;
  504.           OObj = AL_CCOneServ;
  505.         /* Compute Array of Computer IDs */
  506.         CompIdLupArr = ""; // Computer Id Array
  507.         CkCArr.length = 0; // reset Checked computer array
  508.         
  509.         if ( SevDefault ) {
  510.             AL_WASeveritySel.selectedIndex = 2;
  511.             AL_WASeverity.value = "Critical";
  512.         }
  513.         
  514.        for ( var i=0,j=0,srvcix; i<AC_ServicesStoreArr.length; i+=ServicesRecLength ) {
  515.            if ( AC_ServicesStoreArr[i+1] == curAGRPID ) {
  516.                srvcix = i; // save found index for typical entry
  517.                 CkCArr[j] = AC_ServicesStoreArr[i]; // save in Array of Checked computers
  518.                 if ( j > 0) {
  519.                    CompIdLupArr += ","; // array id separator
  520.                 }
  521.                 else { // check if Suspended
  522.                     srvcarr = AC_ServicesStoreArr[i+3].split("~");
  523.                     AL_Suspend.checked = ( srvcarr[11] == "1" ) ? "checked" : "";
  524.                 }    
  525.                 CompIdLupArr += CkCArr[j];
  526.                   ++j; // bump computer count
  527.            }
  528.         }
  529.         SrvcNmeRow.style.visibility = "visible";
  530.         if ( j == 0 ) { // if no computers, invalid AlertGroup
  531.             top.Rstatus.Pstat("No Services Found Error!",true);
  532.             processPopInError();
  533.             return; 
  534.         }
  535.         // Determine if scroll bars required
  536.         AL_CCOneServ.style.overflow = ( j > 9 ) ? "scroll" : "";
  537.  
  538.         // Set up Dependency info if any
  539.         var did = AlertStoreArr[idx+23];
  540.         pwrka = did.split("]["); // parse out Suppress Monitoring parameters
  541.         did = pwrka[0]; // Dependency
  542.  
  543.         // initialize the Suppress Monitoring parameters        
  544.         for ( var i=0; i<6; i++ ) {
  545.            Suppress1[i] = Suppress2[i] = 0;
  546.         }
  547.         if ( pwrka.length > 1 ) {
  548.             if (pwrka[1] != "" ) { 
  549.                 Suppress1 = pwrka[1].split("^");
  550.             }
  551.         }
  552.         processInactPer1Value();  // go set value
  553.         
  554.         if ( pwrka.length > 2 ) {
  555.             if (pwrka[2] != "" ) { 
  556.                 Suppress2 = pwrka[2].split("^");
  557.             }
  558.         }
  559.         processInactPer2Value(); // go set value
  560.         
  561.         AL_Dependency.value = ""; // preset
  562.         AL_DependencySel.options[0].selected = "selected";
  563.         if ( did != "" ) {
  564.             for (var i=0; i < AlertStoreArr.length; i+=AlertRecLength) {
  565.                 if ( AlertStoreArr[i+1] == did ) {
  566.                     AL_Dependency.value = AlertStoreArr[i];
  567.                     for ( var j=1; j<AL_DependencySel.length; j++ ) {
  568.                         if ( AL_DependencySel.options[j].text == AL_Dependency.value ) {
  569.                             AL_DependencySel.options[j].selected = "selected";        
  570.                             break;
  571.                         }
  572.                     }
  573.                     break;
  574.                 }
  575.             }
  576.         }                
  577.  
  578.        AL_SrvcNme.value = curSrvcName = AC_ServicesStoreArr[srvcix+2]; // Service name
  579.        if ( AL_SrvcNme.value == "AGENT" ) {
  580.            AgentOptions.style.visibility = "visible";
  581.         }
  582.         else {
  583.            AgentOptions.style.visibility = "hidden";
  584.         }
  585.  
  586.        var freqar = new Array(); 
  587.        freqar = AC_ServicesStoreArr[srvcix+3].split("~"); // Parse Services string
  588.        if ( freqar[7] != "0" ) { SrvUnits = 0; SrvCount = parseInt(freqar[7],10); }
  589.        else if ( freqar[8] != "0" ) { SrvUnits = 1; SrvCount = parseInt(freqar[8],10); }
  590.        else if ( freqar[9] != "0" ) { SrvUnits = 2; SrvCount = parseInt(freqar[9],10); }
  591.        else if ( freqar[10] != "0" ) { SrvUnits = 3; SrvCount = parseInt(freqar[10],10); }
  592.         AL_SrvFreq.value = " " + SrvCount + " " + SchedTxtArray[SrvUnits];
  593.         AL_MaxAlerts.value = MaxAlertsCount = AL_Thrsh.value;
  594.         
  595.        if ( AL_SrvcNme.value == "AGENT" ) {
  596.             var ckarr = new Array();
  597.             ckarr = freqar[13].split(",");
  598.             AL_MemCheck.value = ckarr[0];
  599.             AL_HDDCheck.value = ckarr[1];
  600.         }
  601.         
  602.         formatComputerDisplay(); // format display for computer output
  603.         processPopulateCounterInputComplete(); // Start lookup for Computer Names/Descriptions
  604.     }
  605.     else if ( StartDT == "01/01/1999 11:50:00" || StartDT == "1/1/1999 11:50:0" ) { // User type
  606.         CurrentAT = UserType;
  607.         OObj = null; // Object output
  608.         SetButtonState(UNewButton,"0");    
  609.         SetButtonState(UEditButton,"0");    
  610.         SetButtonState(UDupButton,"0");    
  611.         SetButtonState(UDeleteButton,"0");
  612.         PINP_Bsy = false;
  613.         if    (AL_AlertSel.style.display == "" && AL_AlertSel.style.visibility != "hidden" && !AL_AlertSel.disabled) { 
  614.             AL_AlertSel.focus();
  615.         }
  616.         top.Rstatus.Pstat("");
  617.     }
  618.     else if ( StartDT == "01/01/1999 11:40:00" || StartDT == "1/1/1999 11:40:0" ) { // EventLog type
  619.         CurrentAT = EventLogType;
  620.         OObj = AL_CCOneEventLog; // Object output
  621.         formatComputerDisplay(); // format display for computer output
  622.         processPopulateELComputers(); 
  623.     }
  624.     else if ( StartDT == "01/01/1999 11:20:00" || StartDT == "1/1/1999 11:20:0" ) { // SNMP Trap type
  625.         CurrentAT = SNMPTrapType;
  626.         OObj = AL_CCOneSNMPTrap; // Computer output
  627.         formatComputerDisplay(); // format display for computer output
  628.         ALMode = ""; // reset mode
  629.         processPopulateSNMPTrapComputers(); 
  630.     }
  631.     else if ( StartDT == "01/01/1999 11:10:00" || StartDT == "1/1/1999 11:10:0" ) { // Win Srvcs type
  632.         CurrentAT = WinServicesType;
  633.         OObj = AL_CCOneWinServ; // Computer output
  634.         formatComputerDisplay(); // format display for computer output
  635.         ALMode = ""; // reset mode
  636.         processPopulateWSTComputers();
  637.     }
  638.     else if ( StartDT == "01/01/1999 11:00:00" || StartDT == "1/1/1999 11:0:0" ) { // File Check type
  639.         CurrentAT = FileCheckType;
  640.         OObj = AL_CCOneFileCheck; // Computer output
  641.         formatComputerDisplay(); // format display for computer output
  642.         ALMode = ""; // reset mode
  643.         processPopulateFileCheckComputers();
  644.     }
  645.     else if ( StartDT == "01/01/1999 11:12:00" || StartDT == "1/1/1999 11:12:0" ) { // File Check type
  646.         CurrentAT = ProcessCheckType;
  647.         OObj = AL_CCOneProcessCheck; // Computer output
  648.         formatComputerDisplay(); // format display for computer output
  649.         ALMode = ""; // reset mode
  650.         processPopulateProcessCheckComputers();
  651.     }
  652.     else if ( StartDT == "01/01/1999 11:15:00" || StartDT == "1/1/1999 11:15:0" ) { // Syslog Check type
  653.         CurrentAT = SyslogCheckType;
  654.         OObj = AL_CCOneSyslogCheck; // Computer output
  655.         formatComputerDisplay(); // format display for computer output
  656.         ALMode = ""; // reset mode
  657.         processPopulateSyslogCheckComputers();
  658.     }
  659.     else {
  660.         CurrentAT = CounterType;
  661.           OObj = AL_CCOne;
  662.  
  663.         // Fix up EveryTime check box 
  664.         AL_EveryT.checked = (CDUnits == 0 && CDCount == 1) ? "checked" : "";
  665.         
  666.         // Set suspened checkbox if S/D/T indicates it
  667.         AL_Suspend.checked = ""; // preset not suspended
  668.         var did = AlertStoreArr[idx+23];
  669.         var pwrka = new Array();
  670.         pwrka = did.split("]["); // parse out Dependency, Suppress Monitoring parameters, & Counter MaxAlerts
  671.         AL_MaxAlerts.value = MaxAlertsCount = (pwrka.length >= 4) ? pwrka[3] : "";
  672.         var cwr = (pwrka.length >= 5) ? pwrka[4] : "0";
  673.         AL_CWRestore.checked = (cwr == "0") ? "" : "checked";
  674.         
  675.         if ( OCArray == "" ) { // if COC Array empty
  676.             top.Rstatus.Pstat("No Servers Found Error!",true);
  677.             processPopInError();
  678.             return; 
  679.         }
  680.         var WrkArr = new Array(); // working array
  681.         var nd = ""; // Name,Description string
  682.         // get Obj ID from first triplet of "CompId.ObjId,CntrId"
  683.         WrkArr = OCArray[0].split(","); 
  684.         CurObjID = WrkArr[1]; // Get Object ID; Set CurObjIx
  685.         CurCntrID = WrkArr[2]; // Get Counter ID
  686.         nd = getObjectName(CurObjID);
  687.         if ( nd == null ) {
  688.             PINP_Bsy = false;
  689.             top.Rstatus.Pstat("Invalid ObjectID from Object Entry",true);
  690.            return;
  691.         }
  692.         WrkArr = nd.split(","); // Split Name and Description
  693.         CurObjName = WrkArr[0]; // Current Object expanded
  694.         CurObjDesc = WrkArr[1]; // Object Description
  695.         CurCntrName = ""; // Init Open Counter name
  696.  
  697.         /* Lookup Counter Name and Description */
  698.         if ( RpmCC_AL.CounterLookupForObjCntrArray("CounterID,"+CurCntrID) ) {
  699.             ALupMode = "";
  700.             top.Rstatus.Pstat("Unable to start the Counter lookup request",true);
  701.              SetButtonState(UNewButton,"0");    
  702.         }
  703.         else {
  704.             ALupMode = "CounterLookupPopIn"; // set Mode of operation
  705.             top.Rstatus.Pstat("One moment while Counter lookup request completes");
  706.         }
  707.     }    
  708.     if ( OObj != null ) {
  709.         OObj.style.backgroundColor = "threedlightshadow";
  710.         OObj.style.height = CCOneBoxHeight;
  711.         OObj.innerHTML = ""; // clear current display
  712.     }
  713.     AL_RunIt.checked = (AlertStoreArr[idx+11] == "1") ? "checked" : "";
  714.     AL_ExecP.style.display = "";
  715.     AL_ArgsP.style.display = "";
  716.  
  717.     var rpn = (AlertStoreArr[idx+12].length == 0) ? "" : AlertStoreArr[idx+12];
  718.     if ( rpn == '>"RESTART"' ) { // execute remote reboot?
  719.         document.RunPrgmRadio.AL_PLoc[0].checked = "";    
  720.         document.RunPrgmRadio.AL_PLoc[1].checked = "";    
  721.         document.RunPrgmRadio.AL_PLoc[2].checked = "checked";    
  722.         rpn = ""; 
  723.         processPLocClick();
  724.     }
  725.     else if ( rpn.charAt(0) == ">" ) { // execute remotely?
  726.         document.RunPrgmRadio.AL_PLoc[0].checked = "";    
  727.         document.RunPrgmRadio.AL_PLoc[1].checked = "checked";    
  728.         document.RunPrgmRadio.AL_PLoc[2].checked = "";    
  729.         rpn = rpn.substring(1,rpn.length); // strip off ">"
  730.     }
  731.     else {   
  732.         document.RunPrgmRadio.AL_PLoc[0].checked = "checked";    
  733.         document.RunPrgmRadio.AL_PLoc[1].checked = "";    
  734.         document.RunPrgmRadio.AL_PLoc[2].checked = "";    
  735.     }
  736.     AL_ExecP.value = rpn;
  737.     AL_ArgsP.value = (AlertStoreArr[idx+13].length == 0) ? "" : AlertStoreArr[idx+13];
  738.     AL_ENotify.checked = (AlertStoreArr[idx+14] == "1") ? "checked" : "";
  739.     AL_EAddr.value = (AlertStoreArr[idx+15].length == 0) ? "" : AlertStoreArr[idx+15];
  740.     var est = (AlertStoreArr[idx+16].length == 0) ? "" : AlertStoreArr[idx+16];
  741.     var estarr = new Array();
  742.     estarr = est.split("[+]");
  743.     AL_ESubj.value = estarr[0];
  744.     EmailText.value = ( estarr.length > 1 ) ? estarr[1] : "";
  745.     EmailTextDefined.style.display = ( EmailText.value != "" ) ? "" : "none";
  746.     
  747.     AL_Phone.checked = (AlertStoreArr[idx+17] == "1") ? "checked" : "";
  748.     var wnbr = (AlertStoreArr[idx+18].length == 0) ? "" : AlertStoreArr[idx+18];
  749.     
  750.     // Analyze Pager string to parse correctly
  751.     AL_PhoneNbr.value = wnbr; // preset
  752.     if ( wnbr.indexOf("^") >= 0 ) {
  753.         wnarr = wnbr.split("^");
  754.         estarr = wnarr[0].split("[+]");
  755.         AL_AccessNbr.value = estarr.join(";");
  756.         if ( wnarr[1].indexOf(";") >= 0 ) {
  757.             wnarr = wnarr[1].split(";");
  758.             estarr = wnarr[0].split("[+]");
  759.             AL_PagePswd.value = estarr.join(";");
  760.         }
  761.         estarr = wnarr[1].split("[+]");
  762.         AL_PhoneNbr.value = estarr.join(";");
  763.     }
  764.     else if ( wnbr.indexOf(";") >= 0 ) {
  765.         wnarr = wnbr.split(";");
  766.         estarr = wnarr[0].split("[+]");
  767.         AL_AccessNbr.value = estarr.join(";");
  768.         AL_PhoneNbr.value = wnarr[1];
  769.         estarr = wnarr[1].split("[+]");
  770.         AL_PhoneNbr.value = estarr.join(";");
  771.     }
  772.             
  773.     AL_TTSpeak.value = (AlertStoreArr[idx+19].length == 0) ? "" : AlertStoreArr[idx+19];
  774.     AL_Beeper.checked = (AlertStoreArr[idx+20] == "1") ? "checked" : "";
  775.     AL_BeeperNbr.value = (AlertStoreArr[idx+21].length == 0) ? "" : AlertStoreArr[idx+21];
  776.     AL_TTSend.value = (AlertStoreArr[idx+22].length == 0) ? "" : AlertStoreArr[idx+22];
  777.         
  778.     AL_Sched.value = (AL_EveryT.checked) ? "" : AL_Sched.value;
  779.     wrk = SmtpServerAddress.split("~"); 
  780.     AL_Smtp.value = wrk.join("; ");
  781.     processTypeClick();
  782. }
  783. function processPopInError() {
  784.     AGerr = true; // set state
  785.     OObj.innerHTML = ""; // clear
  786.     SetButtonState(UNewButton,"0");    
  787.     SetButtonState(UEditButton,"0");    
  788.     SetButtonState(UDupButton,"0");    
  789.     SetButtonState(UDeleteButton,"0");
  790.     processTypeClick();
  791.     curSrvcName = null; // Reset durrent Service Name
  792.     LastCmpSelectedSuffix = null;
  793.    CmpsSelectedCount = 0; // reset count
  794.     AL_CCOneServ.style.backgroundColor = "threedlightshadow";
  795.     AL_CCOneServ.style.height = CCOneBoxHeight;
  796.     AL_CCOneServ.style.overflow = "";
  797.     AL_AlertSel.disabled = "";
  798.     if    (AL_AlertSel.style.display == "" && AL_AlertSel.style.visibility != "hidden") { 
  799.         AL_AlertSel.focus();
  800.     }
  801.     PINP_Bsy = false;
  802.     return;
  803. }
  804.  
  805. /* Initiate read for Event Log Monitored Computers */
  806. function processPopulateELComputers() {
  807.     if ( RpmCC_AL.ELMonitorLookupByAlertGroup(curAGRPID) ) {
  808.         ALupMode = "";
  809.         PINP_Bsy = false;
  810.         top.Rstatus.Pstat("Unable to start the Server lookup request",true);
  811.     }
  812.     else {
  813.         CountOfComps = CountOfCompsRcvd = 0; 
  814.         CompIdLupArr = ""; // Computer Id Array
  815.         ALupMode = "ELComputerLookupPopIn"; // Mode
  816.         top.Rstatus.Pstat("One moment while Server lookup request completes");
  817.     }
  818. }
  819. function processELMonitorLookupRecord(ELCrec) {
  820.     var wrkarr = new Array();
  821.     ++CountOfCompsRcvd;
  822.     wrkarr = ELCrec.split("~"); // parse the computer record
  823.     if ( CountOfCompsRcvd == 1 ) { // if first
  824.          // Set specifications
  825.         for ( var i=0; i<LogTable.length; i++ ) {
  826.            if ( LogTable[i] == wrkarr[4] ) {
  827.                AL_EvLogName.options[i].selected = "selected";     // Select log
  828.                AL_LogNmeDisp.value = wrkarr[4];
  829.                break;
  830.            }
  831.        }
  832.        if (wrkarr[5] == "0") wrkarr[5] = "";
  833.         for ( var i=0; i<TypeTable.length; i++ ) {
  834.            if ( TypeTable[i] == wrkarr[5] ) {
  835.                 AL_EvLogType.options[i].selected = "selected";     // Select type
  836.                AL_LogTypeDisp.value = AL_EvLogType.options[i].text;
  837.                break;
  838.            }
  839.        }
  840.        
  841.         AL_EvSrc.value = (wrkarr[11] == "0") ? "": wrkarr[6];
  842.         AL_EvCat.value = (wrkarr[12] == "0") ? "": wrkarr[7];
  843.         AL_EvID.value = (wrkarr[13] == "0") ? "": wrkarr[8];
  844.         
  845.         var warr = new Array();
  846.         AL_EvMsg.value = (wrkarr[14] == "0") ? "": wrkarr[9];
  847.         warr = AL_EvMsg.value.split("\x09");
  848.         if ( warr.length > 1 ) {
  849.            AL_EvMsg.value = warr.join("&T");
  850.         }
  851.  
  852.         
  853.         AL_LogNot.checked = (wrkarr[15] == "1") ? "": "checked"; 
  854.         AL_LogAnd.checked = (wrkarr[16] == "0") ? "": "checked";
  855.         AL_LogExclude.checked = (wrkarr.length >= 19 && wrkarr[18] == "1") ? "checked" : "";
  856.         AL_Suspend.checked = (wrkarr[1] == "1") ? "": "checked";
  857.         if ( wrkarr.length >= 18 ) {
  858.             AL_ELPrec.selectedIndex = parseInt(wrkarr[17],10);
  859.         }
  860.     }
  861.     else {
  862.          CompIdLupArr += ","; // Computer Id Array
  863.     }
  864.     CompIdLupArr += wrkarr[2]; // Computer Id Array
  865. }
  866.  
  867. // Common format for Computers Output Display
  868. function formatComputerDisplay() {
  869.     Tops = "<table border='0' cellpadding='0' cellSpacing='1' width='492'>";
  870.     Tops += "<tr><td colspan='2' width='100%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Selections</td></tr>";
  871.     
  872.     Tops += "<tr><td width='50%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Server/Computer Name</td>";
  873.     Tops += "<td width='50%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Description</td></tr>";
  874. }
  875.  
  876. var CountOfComps = 0;
  877. var CountOfCompsRcvd = 0;
  878. var CompIdLupArr = "";
  879. function processPopulateInputCounter(CntrNme,CntrDesc,OCA) {
  880.     if (     CurCntrName != "" ) { // If Current Open Counter Name define
  881.         return; // exit since already found
  882.     }
  883.         
  884.     var OCWrkArr = new Array(); // working array
  885.     var WrkArr = new Array(); // working array
  886.     
  887.     OCWrkArr = OCA.split(";"); // Get ObjID,CounterID pair
  888.     smax = --OCWrkArr.length; // adjust for null last entry
  889.     for ( var i=0; i<smax; i++ ) {
  890.         WrkArr = OCWrkArr[i].split(","); // get Cntr ID from pair of "ObjID,CntrID"
  891.         if (CurCntrID == WrkArr[1]) // if match on CntrID
  892.             break;
  893.     }    
  894.     if ( i >= smax ) { // if no match
  895.         PINP_Bsy = false;
  896.         return;
  897.     }
  898.     CntrObNmeRow.style.visibility = "visible";
  899.     AL_CntrNme.value = CurCntrName = CntrNme; // Current Open Counter
  900.     CurCntrDesc = CntrDesc;
  901.     AL_ObjNme.value = CurObjName;
  902.     CntrObNmeRow.style.visibility = "visible";
  903.     formatComputerDisplay(); // format display for computer output
  904.  
  905.     /* Compute Array of Computer IDs */
  906.     CompIdLupArr = ""; // Computer Id Array
  907.     CkCArr.length = 0; // reset Checked computer array
  908.     smax = --OCArray.length; // adjust for null last entry
  909.     for ( i=0; i<smax; i++ ) {
  910.     // get Computer ID from triplet of "CompId.ObjId,CntrId"
  911.         WrkArr = OCArray[i].split(","); 
  912.         CkCArr[i] = WrkArr[0]; // save in Array of Checked computers
  913.         if ( i > 0) {
  914.            CompIdLupArr += ","; // array id separator
  915.         }
  916.         CompIdLupArr += WrkArr[0];
  917.     }
  918.     // Determine if scroll bars required
  919.     AL_CCOne.style.overflow = ( CkCArr.length > 9 ) ? "scroll" : "";
  920. }
  921.  
  922. /* OpComplete for the CounterLookupForObjCounterArray */
  923. function processPopulateCounterInputComplete() {
  924.     /* Lookup Computer Names and Descriptions */
  925.     if ( RpmCC_AL.ComputerLookupByIDArray(CompIdLupArr) ) {
  926.         ALupMode = "";
  927.         PINP_Bsy = false;
  928.         top.Rstatus.Pstat("Unable to start the Server lookup request",true);
  929.     }
  930.     else {
  931.         CountOfComps = CountOfCompsRcvd = 0; 
  932.         ALupMode = "ComputerLookupPopIn"; // Mode
  933.         top.Rstatus.Pstat("One moment while Server lookup request completes");
  934.     }
  935. }
  936.  
  937. function processPopulateInputComputer(CmpNme,CmpDesc,Cid) {
  938.     /* Format Computer Name and Description */
  939.     var tw = ( CurrentAT == WinServicesType ) ? "optextb" : "optext";
  940.     Tparm = ( AL_Suspend.checked ) ? "optextr" : tw;
  941.     Tops += "<tr><td width='50%' class='"+Tparm+"' title='"+CmpNme+"'>";
  942.     var CmpNmeN = ( CmpNme.length > 40 ) ? CmpNme.substring(0,40)+"..." : CmpNme;
  943.     Tops += CmpNmeN + "</td>";
  944.     Tops += "<td width='50%' class='"+Tparm+"' title='"+CmpDesc+"'>";
  945.     var CmpDescN = ( CmpDesc.length > 40 ) ? CmpDesc.substring(0,40)+"..." : CmpDesc;
  946.     Tops += CmpDescN + "</td></tr>";
  947.     // If Windows Services
  948.     if ( CurrentAT == WinServicesType ) {
  949.         var SrvId, SrvcName, DispName, WAix;
  950.        for ( var i=0; i<WSrvcsLinkIDRecs.length; i+=WSrvcsLinkIDRecsLength ) {
  951.            if ( WSrvcsLinkIDRecs[i+1] == Cid ) {
  952.                SrvId = parseInt(WSrvcsLinkIDRecs[i],10);
  953.                 WAix = GetWinServicesArrEntryIndex( SrvId );
  954.  
  955.                 SrvcName = WinServicesArr[WAix+1]; // get Service Name
  956.                 DispName = WinServicesArr[WAix+2]; // get Display Name
  957.                 Tops += "<tr><td width='100%' colspan='2' class='optext'>    -";
  958.                 Tops += DispName + " ("+SrvcName+")</td></tr>";
  959.             }
  960.         }
  961.     }
  962. }
  963.  
  964. function processPopulateInputComplete() {
  965.     /* Final Format and Output */
  966.     Tops += "</table></center>";
  967.     OObj.insertAdjacentHTML("beforeEnd",Tops);
  968.     OObj.scrollIntoView(true);
  969.     
  970.     ALupMode = "";
  971.     top.Rstatus.Pstat("Request Completed");
  972.     SetButtonState(UNewButton,"0");    
  973.     SetButtonState(UEditButton,"0");    
  974.     SetButtonState(UDupButton,"0");    
  975.     SetButtonState(UDeleteButton,"0");
  976.     SetButtonState(WatchReportButton,"0");
  977.     if    (AL_AlertSel.style.display == "" && !AL_AlertSel.disabled &&
  978.             AL_AlertSel.style.visibility != "hidden") { 
  979.         AL_AlertSel.focus();
  980.     }
  981.     PINP_Bsy = false;
  982.     if ( top.QuickStartProcessing ) {
  983.         showHelp('Help/QuickStart_Help.htm#ConfigureWatches');
  984.         CurrentAT = ServiceType;
  985.         processTypeClick();
  986.         processNewContinue();
  987.         window.focus();
  988.     }
  989. }
  990.  
  991. /* Process Counter and Computer OP Complete Event */
  992. function processCounterOpComplete() {
  993.     /* If PopulateInputCounter,  Go process */
  994.     if (ALupMode == "CounterLookupPopIn") {
  995.         processPopulateCounterInputComplete()
  996.     }
  997.     /* If PopulateInputComputer,  Go process */
  998.     else if (ALupMode == "ComputerLookupPopIn") {
  999.         processPopulateInputComplete();
  1000.     } 
  1001.     /* If Counter Edit, Go process */
  1002.     else if (ALupMode == "CounterLookupEdit") {
  1003.         processEditCounterComplete();
  1004.     } 
  1005.     /* If Computer Edit, Go process */
  1006.     else if (ALupMode == "ComputerLookupEdit") {
  1007.         processEditComputerComplete();
  1008.     } 
  1009.     /* If Computer Edit, Go process */
  1010.     else if (ALupMode == "SrvComputerLookupEdit") {
  1011.         processEditSrvComputerComplete();
  1012.     } 
  1013. }
  1014.  
  1015.  
  1016. var ELM_Ar = new Array();
  1017. function createElmArray() {
  1018.     ELM_Ar.length = 0; // reset array
  1019.     // Find & create array of selected computers
  1020.       for ( var i=0, j=0, k=0; i<CompRecCount; ++i ) {
  1021.           j = (i*CompRecLength); // index to Computer entry in store
  1022.           if ( AC_CompStoreArr[j+4] == "1" ) { // if selected
  1023.              ELM_Ar[k++] = AC_CompStoreArr[j]; // save computer ID
  1024.          }
  1025.     }
  1026.     return ((k==0) ? false : true);
  1027. }
  1028. var TypeTable = new Array("","1","2","4","8","16","24");
  1029. var LogTable = new Array("Application","Security","System","Directory Service","DNS Server","File Replication Service");
  1030. function processELMonitorAdd() {
  1031.     // Get parameters
  1032.     var LogSus = (AL_Suspend.checked) ? "0" :"1";
  1033.     var LogSel = LogTable[AL_EvLogName.selectedIndex];
  1034.     var TypeSel = TypeTable[AL_EvLogType.selectedIndex];
  1035.     var cType = (TypeSel == "")? "0" : "1";
  1036.     var cSrc = (AL_EvSrc.value == "") ? "0": "1";
  1037.     var cCat = (AL_EvCat.value == "") ? "0": "1";
  1038.     var cID = (AL_EvID.value == "") ? "0": "1";
  1039.     var cMsg = (AL_EvMsg.value == "") ? "0": "1";
  1040.     var cAnd = (AL_LogAnd.checked) ? "1": "0";
  1041.     var pMsg = (AL_LogNot.checked) ? "0": "1"; //"1";  pMsg = "1" -> Inclusion
  1042.     var eMsg = (AL_LogExclude.checked) ? "1": "0"; 
  1043.     var pStrg = curAGRPID;// Alert Group ID
  1044.     var Precedence = AL_ELPrec.selectedIndex;
  1045.  
  1046.     var warr = new Array();
  1047.     warr = AL_EvMsg.value.split("&T");
  1048.     if ( warr.length > 1 ) {
  1049.         AL_EvMsg.value = warr.join("\x09");
  1050.     }
  1051.  
  1052.     // Build Argument string for all computers selected
  1053.     for ( var i=0; i<ELM_Ar.length; i++ ) {
  1054.         pStrg += "~"+LogSus+"~"+ELM_Ar[i]+"~"+LogSel+"~"+TypeSel+"~"+AL_EvSrc.value;
  1055.         pStrg += "~"+AL_EvCat.value+"~"+AL_EvID.value+"~"+AL_EvMsg.value;
  1056.         pStrg += "~"+cType+"~"+cSrc+"~"+cCat+"~"+cID+"~"+cMsg+"~"+pMsg+"~"+cAnd+"~"+Precedence+"~"+eMsg;
  1057.     }
  1058.     // if unable to initiate request        
  1059.     if ( RpmCC_AL.ELMonitorAdd(pStrg) ) { 
  1060.         top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  1061.         processResetButton();
  1062.     }
  1063.     else { // waiting for OperationCompleteEvent
  1064.         top.Rstatus.Pstat("One moment while UPDATE request completes");
  1065.         processGeneralClick(CounterTab);
  1066.     }
  1067. }
  1068. function processELMonitorOpComplete() {
  1069.     if ( ALupMode == "ELComputerLookupPopIn" ) {
  1070.         if ( CountOfCompsRcvd > 0 ) {
  1071.             processPopulateELComputersComplete(); // Complete, delay 100 ms. then finish
  1072.         }
  1073.         else {
  1074.             ALMode = ""; // reset mode
  1075.              top.Rstatus.Pstat("No associated Servers found for this EventLogWatch",true);
  1076.              processPopInError(); // go reset
  1077.          }
  1078.     }
  1079.     else if ( ALupMode == "ELMonitorAdd" ) {
  1080.         ALupMode = "";
  1081.         if ( ALMode == "New" ) {
  1082.             ALMode = ""; // reset mode
  1083.             processAlLookupReset();
  1084.         }
  1085.         else if ( ALMode == "Edit" ) {
  1086.             // Insure Service Checking is Enabled
  1087.             //if ( RpmCC_AL.StartStopServicesCheck("1") ) { // if unable to initiate request        
  1088.             //    top.Rstatus.Pstat("Unable to restart the SERVICES Checking",true);
  1089.             //}
  1090.             ALMode = ""; // reset mode
  1091.             finishEditComplete();
  1092.         }
  1093.     }
  1094.     else if ( ALupMode == "ELMDelAll" ) {
  1095.         if ( ALMode == "Edit" ) {
  1096.            ALupMode = "ELMonitorAdd";
  1097.            processELMonitorAdd();
  1098.        }
  1099.    }
  1100. }
  1101. function processPopulateELComputersComplete() {
  1102.     AL_CCOneEventLog.style.overflow = ( CountOfCompsRcvd > 9 ) ? "scroll" : "";
  1103.     processPopulateCounterInputComplete();
  1104. }
  1105.  
  1106. function processELMonitorOpError() {
  1107.     top.Rstatus.Pstat("Error updating EventLogWatcht",true);
  1108.     processResetButton();
  1109. }
  1110.  
  1111. //-----------------------------------------------------------------------
  1112. /* Windows Services Monitoring Routines */
  1113. //
  1114. function processWinSrvcsDisplayChoice() {
  1115.     var wsdc = (document.WinSrvcRadio.AL_WinSrvcDisp[1].checked ) ? "1" : "0";
  1116.     top.banner.RpmCC_Ban.RegSetKey(top.banner.ServerID+"WinServicesDisplayChoice",wsdc); // set state
  1117.     processGroupOpComplete();
  1118. }
  1119.  
  1120. // Process and Display the Windows Services Tree
  1121. function processWinServicesTree() {
  1122.     AL_CCOneWinServ.innerHTML = ""; // clear
  1123.     var wsdc = top.banner.RpmCC_Ban.RegGetKey(top.banner.ServerID+"WinServicesDisplayChoice"); // set state
  1124.     document.WinSrvcRadio.AL_WinSrvcDisp[1].checked = ( wsdc == "1" ) ? "checked" : "";
  1125.     if ( WinServciesMonitorLookupRequired ) { // force reread of Monitor records?
  1126.         GetWinServicesMonitorRecords(); 
  1127.         ALupMode = "WinSrvsTreeSetup";
  1128.     }
  1129.     else {
  1130.         processWinServicesTreeContinue();
  1131.     }
  1132. }
  1133. function processWinServicesTreeContinue() {
  1134.     processInitialLookup("WinSrvcCompLookup");
  1135. }
  1136.  
  1137. var WCSrvcsDispCount = 0;
  1138. var LWCSDispIx = 0;
  1139. function processWinServicesByService() {
  1140.     AL_CCOneWinServ.innerHTML = ""; // clear
  1141.      setOutHeader("Windows Services : Server/Computer Tree"); // define output table header    
  1142.     var SelT = "<table border='0' cellpadding='0' cellSpacing='1' width='490'>";
  1143.     SelT += "<tr><td width='100%' height='2' align='center' valign='top' class='optextb' style='background-color:graytext; color:captiontext'>Selections</td></tr></table>";
  1144.     CCEs = SelT+CCEs;
  1145.     WCSrvcsDispCount = 0;
  1146.     LWCSDispIx = 0;
  1147.     wsbsIx = 0;
  1148.     processWinServicesByServiceContinue();
  1149. }
  1150.  
  1151. var wsbsIx = 0;
  1152. function processWinServicesByServiceContinue() {
  1153.     Tid = null;
  1154.     var WSAmax = WinServicesSortedArr.length, WSAix = 0;
  1155.     var loopcount = 0;
  1156.     for ( var i = wsbsIx; i<WSAmax && loopcount < 25; loopcount++, ++i) {
  1157.         WSAix = WinServicesSortedArr[i] * WinServicesArrEntrySz;
  1158.         Iprefx = ( i+1 >= WSAmax ) ? "L" : "T";
  1159.         CCEs += "<table border='0' cellpadding='0' cellSpacing='0' width='490'><tr><td width='25'> </td>";
  1160.         CCEs += "<td width='19' align='center'><img id='wsra" + WSAix + "' expanded='0' src='images/" + Iprefx + "plus.gif' style='cursor:hand' onclick='procWinSrvImgClick(this)' width='19' height='20'></td>";
  1161.         CCEs += "<td width='19' align='center'><img id='wsrb" + WSAix + "' src='images/WinServices.gif' style='cursor:hand' onclick='procWinSrvImgClick(this)' width='18' height='18' title='";
  1162.         CCEs += "'></td><td width='*' slid='' somechecked=0 class='optext' id='wsrc" + WSAix + "'>" + WinServicesArr[WSAix+2] + " ("+WinServicesArr[WSAix+1]+")</td></tr></table>";
  1163.         CCEs += "<div id='wsrx" + WSAix + "' wslrec='' somechecked=0 checkedcomps=0 compcount=0 compchkcount=0></div>";
  1164.         ++WCSrvcsDispCount; // bump count
  1165.         LWCSDispIx = (WSAix > LWCSDispIx) ? WSAix : LWCSDispIx; // save index to identify last service
  1166.       }
  1167.     AL_CCOneWinServ.insertAdjacentHTML("beforeEnd",CCEs);
  1168.  
  1169.     wsbsIx = i;
  1170.     CCEs = "";
  1171.     if ( i >= WSAmax ) {
  1172.         Tid = setTimeout("processWinServicesByServiceDone()",50); // delay 50 ms. then process        
  1173.     }
  1174.     else {
  1175.         Tid = setTimeout("processWinServicesByServiceContinue()",50); // delay 50 ms. then process            
  1176.     }
  1177. }
  1178. function processWinServicesByServiceDone() {    
  1179.     if ( ALMode == "New" ) {
  1180.         SetButtonState(UUpdateButton,"0");
  1181.         SetButtonState(UResetButton,"0");
  1182.         top.Rstatus.Pstat("Done");
  1183.     }
  1184.     else { // Edit
  1185.         WSCMAix = 0; // initialize
  1186.         WSrvcsCompLinkIDRecs.length = 0;
  1187.         WSrvcsCompLinkIDRecsIndex = 0;
  1188.         ALupMode = "WSrvcsCompLinkLookup";
  1189.        processWSrvcsCompLinkIDLookup();
  1190.     }
  1191. }
  1192.  
  1193. // Get Computer and Service for each Monitor Service record
  1194. function processWSrvcsCompLinkIDLookup() {
  1195.     var i=0, ArgStr = "";
  1196.     while (  i < WinServicesMonitorArr.length ) {
  1197.         if ( WinServicesMonitorArr[i+3] == curAGRPID ) {
  1198.             ArgStr += WinServicesMonitorArr[i+2]+"~";
  1199.         }
  1200.         i += WinServicesMonitorArrEntrySz; // bump index
  1201.     }
  1202.     if (  RpmCC_AL.NTServicesLinkListLookupByID( ArgStr ) ) { 
  1203.         // if unable to initiate request        
  1204.         ALupMode = ""; // reset
  1205.         PINP_Bsy = false;
  1206.         top.Rstatus.Pstat("Unable to start the WinServicesWatch Server lookup request",true);
  1207.     }
  1208. }
  1209. // Process each NT services Link Record
  1210. var WSrvcsCompLinkIDRecs = new Array();
  1211. var WSrvcsCompLinkIDRecsIndex = 0;
  1212. var WSrvcsCompLinkIDRecsLength = 3;
  1213. function processWSrvcsCompLinkIDLookupRecord(WSLIDrec) {
  1214.     var warr = new Array();
  1215.     var warr1 = new Array();
  1216.     WSrvcsCompLinkIDRecsIndex = 0; // reset
  1217.     warr1 = WSLIDrec.split(";");
  1218.     for ( var i=0; i<warr1.length; i++ ) {
  1219.         warr = warr1[i].split("~");
  1220.         WSrvcsCompLinkIDRecs[ WSrvcsCompLinkIDRecsIndex++ ] = warr[1]; //Services List ID
  1221.         WSrvcsCompLinkIDRecs[ WSrvcsCompLinkIDRecsIndex++ ] = warr[2]; //Computer ID
  1222.         WSrvcsCompLinkIDRecs[ WSrvcsCompLinkIDRecsIndex++ ] = warr[0]; //Services Link ID
  1223.     }
  1224.     WSCObjArr.length = 0; // reset
  1225.     WSCObjArrIx = 0;
  1226.     processWinSrvcCompLupDone();
  1227. }
  1228.  
  1229. var WSCObjArr = new Array();
  1230. var WSCObjArrIx = 0;
  1231. function processWinSrvcCompLupDone() {
  1232.     WSrvcsCompLinkIDRecsIndex = 0; // reset
  1233.     while (  WSrvcsCompLinkIDRecsIndex < WSrvcsCompLinkIDRecs.length ) {
  1234.         var SLid = WSrvcsCompLinkIDRecs[ WSrvcsCompLinkIDRecsIndex ];
  1235.         var srvcid = GetWinServicesArrEntryIndex( parseInt(SLid,10) );
  1236.         var WSObj = document.all["wsrc"+srvcid];
  1237.         WSObj.className = "optextb";
  1238.         WSObj.somechecked = 1;
  1239.         WSObj.slid = SLid;
  1240.         WSrvcsCompLinkIDRecsIndex += WSrvcsCompLinkIDRecsLength; // bump index
  1241.     }
  1242.     ALupMode = "";
  1243.     WSCObjArr.length = 0;
  1244.     SetButtonState(UUpdateButton,"0");
  1245.     SetButtonState(UResetButton,"0");
  1246.     top.Rstatus.Pstat("Done");
  1247. }
  1248.  
  1249. var curWinSrvsIx = null;
  1250. function procWinSrvImgClick(WSimo) {
  1251.     var isx = WSimo.id;  
  1252.     if ( isx.charAt(0) != "w" ) 
  1253.                 return;
  1254.     var cx = isx.substring(4,isx.length); // Strip off index
  1255.     cx = parseInt(cx,10);
  1256.     curWinSrvsIx = cx;
  1257.     var Cpfx = (cx >= LWCSDispIx) ? "L" : "T";
  1258.     
  1259.     var CObj = document.all["wsra"+cx]; // Clicked Service Entry
  1260.     var EObj = document.all["wsrx"+cx];
  1261.     if ( CObj.expanded == "1" ) { // if currently Expanded, Contract
  1262.         CObj.src = "images/"+Cpfx+"Plus.gif";
  1263.           CObj.expanded = "0"; // Set contracted
  1264.         EObj.style.display = "none";
  1265.       }
  1266.     else { // otherwise Expand Windows Services
  1267.         CObj.src = "images/"+Cpfx+"Minus.gif";
  1268.        CObj.expanded = "1"; // Set expanded
  1269.        if ( EObj.wslrec != "" ) {
  1270.                EObj.style.display = ""; 
  1271.         }
  1272.         else if ( RpmCC_AL.NTServicesLinkListLookup("",WinServicesArr[cx]) ) { // Lookup Computers for this Service
  1273.             top.Rstatus.Pstat("Unable to start the WinServicesWatch Server lookup request",true);
  1274.             goResetWait();
  1275.         }
  1276.         else {
  1277.             ALupMode = "WinComputersLookup";
  1278.             return; // exit and await Services Lookup
  1279.         }
  1280.     }
  1281. }
  1282.  
  1283. var WCDs = null;
  1284. var WCMax = 0; // Max count of Computers
  1285. var WinComputersIDArr = new Array();
  1286. var WCCount = 0;
  1287. function processWinComputersLookupRecord(WSLrec) {
  1288.     var WinComputersSortArr = new Array();
  1289.     var WCSACount = 0;
  1290.     var warr = new Array();
  1291.     
  1292.     WinComputersIDArr.length = 0; // reset
  1293.     WinComputersIDArr = WSLrec.split("~"); // parse the string to get the Link List Computer IDs
  1294.     WCCount = 0, WCDs = ""; // initialize
  1295.     WCMax = WinComputersIDArr.length-2; // set number of computers
  1296.     for ( var i=1; i<WCMax; i+=2 ) {
  1297.         for ( var j=0; j<AC_CompStoreArr.length; j+=CompRecLength ) {
  1298.             if ( WinComputersIDArr[i] == AC_CompStoreArr[j] ) { // if found
  1299.                 WinComputersSortArr[WCSACount++] = AC_CompStoreArr[j+2].toLowerCase()+"~"+i+"~"+j;                
  1300.             }
  1301.         }
  1302.     }
  1303.     WinComputersSortArr.sort();
  1304.     for ( var k=0; k<WCSACount; k++ ) {
  1305.         warr = WinComputersSortArr[k].split("~");
  1306.         bLast = ((k+1) >= WCSACount) ? true : false;
  1307.        processWSCExp(parseInt(warr[1],10),parseInt(warr[2],10),bLast); // pass indices to Computer ID Arr & Computer Store        
  1308.     }
  1309.  
  1310.     var EObj = document.all["wsrx"+curWinSrvsIx];
  1311.     EObj.insertAdjacentHTML("beforeEnd",WCDs);
  1312.     EObj.style.display = "";
  1313.     EObj.wslrec = WSLrec; // save
  1314.     EObj.compcount = WCCount; // save count of computers displayed
  1315.     EObj.checkedcomps = 1;
  1316.     ALupMode = ""; // reset
  1317. }
  1318. function processWSCExp(WCix,CSix,bLast) {
  1319.     var warr = new Array();
  1320.     var Mpfx = (bLast) ? "L" : "T";
  1321.     var Opfx = (curWinSrvsIx == LWCSDispIx) ? "White" : "I";
  1322.  
  1323.     var CName = AC_CompStoreArr[CSix+2];
  1324.     var Cid = AC_CompStoreArr[CSix];
  1325.     var SLid =     WinComputersIDArr[WCix+1];
  1326.     var tAGid = findAGIDFromSLID(SLid);
  1327.     var EObj = document.all["wsrx"+curWinSrvsIx];
  1328.     var inuse="";
  1329.     
  1330.     var sDef = (tAGid == curAGRPID || tAGid == "0" ) ? true : false; // if AGID for this Service not found or is same as current AGID
  1331.     WCDs += "<table border='0' cellpadding='0' cellSpacing='0' width='490' >";
  1332.     WCDs += "<tr><td width='25'> </td>";
  1333.     WCDs += "<td width='19' height='20' align='center'><img src='images/" + Opfx + ".gif' width='19' height='20'></td>"      
  1334.     WCDs += "<td width='19' height='20' align='center'><img src='images/" + Mpfx + ".gif' width='19' height='20'></td>";
  1335.       WCDs += "<td width='11' align='center'><img id='csma" + curWinSrvsIx + "_" + WCCount;
  1336.     WCDs +=  "' csix='"+CSix+"' cid='"+Cid+"' slid='" + SLid + "' src='images/"; 
  1337.     if ( sDef ) {
  1338.         if ( EObj.checkedcomps != 1 && tAGid == curAGRPID ) {
  1339.              WCDs += "Checked.gif' checked='1'";
  1340.              inuse = "b";
  1341.              EObj.compchkcount++;
  1342.         }
  1343.         else {
  1344.              WCDs += "Unchecked.gif' checked='0'";
  1345.          }
  1346.          WCDs += " width='9' height='9' onclick='procWCImgClick(this)' style='cursor:hand'";
  1347.     }
  1348.     else {
  1349.         inuse = " title='Assigned to Watch: "+getOnlyAlertName(tAGid)+"'";
  1350.          WCDs += "WinServicesInUse.gif' checked='0' width='18' height='18'"+inuse;
  1351.     }
  1352.       WCDs += "></td>";
  1353.     WCDs += "<td width='*' id='csmb" + curWinSrvsIx + "_" + WCCount;
  1354.     if ( sDef ) {
  1355.         WCDs += "' style='cursor:hand' onclick='procWCImgClick(this)' class='optext"+inuse+"'> ";
  1356.     }
  1357.     else {
  1358.          WCDs += "' class='optext'"+inuse+"> ";
  1359.     }
  1360.     WCDs += CName + "</td>";
  1361.     WCDs += "</tr></table>";
  1362.     ++WCCount; // bump index
  1363. }
  1364. function procWCImgClick(WCIm) {
  1365.     var isx = WCIm.id;  
  1366.     if ( isx.charAt(0) != "c" ) 
  1367.                 return;
  1368.     var cx = isx.substring(4,isx.length); // Strip off index
  1369.     lx = cx.lastIndexOf("_"); // derive suffix to the Computer DIV ID
  1370.     var dx = cx.substring(0,lx);
  1371.  
  1372.     var CObj = document.all["csma"+cx]; // Clicked Checkbox Entry
  1373.     var EObj = document.all["csmb"+cx];
  1374.     var FObj = document.all["wsrx"+dx]; // Computers DIV entry
  1375.     var SNObj = document.all["wsrc"+dx]; // Service Name entry
  1376.  
  1377.     if ( CObj.checked == "1" ) { // if currently Checked, Uncheck
  1378.         CObj.src = "images/Unchecked.gif";
  1379.        CObj.checked = "0"; // Set Unchecked
  1380.        EObj.className = "optext";
  1381.        if ( --FObj.compchkcount == 0 ) {
  1382.              SNObj.className = "optext";
  1383.        }
  1384.       }
  1385.     else { // otherwise Check
  1386.         CObj.src = "images/Checked.gif";
  1387.           CObj.checked = "1"; // Set Checked
  1388.        EObj.className = "optextb";
  1389.        SNObj.className = "optextb";
  1390.        FObj.compchkcount++;
  1391.     }
  1392. }
  1393.  
  1394. // Windows services Add
  1395. var WSM_ArIndex = 0;
  1396. function processWSMonitorAdd(WSAddStat) {
  1397.     var wstat = new Array();
  1398.     wstat = WSAddStat.split(":");
  1399.     if ( wstat[0] == "Err" ) {
  1400.         top.Rstatus.Pstat("Error adding WinServicesWatch record: "+wstat[1],true); 
  1401.         processResetButton();
  1402.         return;
  1403.     }
  1404.     
  1405.     while ( WSM_ArIndex < WSM_Ar.length ) {
  1406.         // Get parameters
  1407.         var pStrg = (( AL_Suspend.checked ) ? "0" : "1")+"~";
  1408.         pStrg += WSM_Ar[WSM_ArIndex++] + "~"; // NT Services Link ID
  1409.         pStrg += curAGRPID + "~";// Alert Group ID
  1410.         pStrg += (AL_WSRestart.checked) ? "0" : "1"; // notify only 
  1411.  
  1412.         // if unable to initiate request        
  1413.         if ( RpmCC_AL.NTServicesMonitorAdd(pStrg) ) { 
  1414.             top.Rstatus.Pstat("Unable to start the UPDATE request",true);
  1415.             processResetButton();
  1416.         }
  1417.         else { // waiting for OperationCompleteEvent
  1418.             top.Rstatus.Pstat("One moment while UPDATE request completes");
  1419.         }
  1420.         return;
  1421.     }
  1422.     // Done with Adds
  1423.     var cStrg = CMN_Ar.join("~");
  1424.     if ( RpmCC_AL.NTServicesMonitorNotify(cStrg) ) { 
  1425.         top.Rstatus.Pstat("Request to update Agents failed",true);
  1426.     }
  1427.     WinServciesMonitorLookupRequired = true; // force reread of Monitor records
  1428.     ALupMode = "";
  1429.     if ( ALMode == "New" ) {
  1430.         ALMode = ""; // reset mode
  1431.         processGeneralClick(CounterTab);
  1432.         processAlLookupReset();
  1433.     }
  1434.     else if ( ALMode == "Edit" ) {
  1435.         ALMode = ""; // reset mode
  1436.         finishEditComplete();
  1437.     }
  1438. }
  1439.  
  1440. // Edit Win Services Monitoring Records for AGID
  1441. function processWSMonitorEdit() {
  1442.     WSrvcsIndex = 0; // Reset Monitor Records Array Index
  1443.     CurWSOp = "Edit";
  1444.     // Go delete all old records, then add current settings
  1445.     processWServicesDeleteContinue("");
  1446. }
  1447.  
  1448.  
  1449. // Delete Win Services Monitoring Records for AGID
  1450. var WSAGdel = null;
  1451. var CurWSCArr = "";
  1452. var CurWSOp = "";
  1453. function processWinServicesDelete(AlrtID) {
  1454.     WSAGdel = AlrtID; // save AGid to delete
  1455.     WSrvcsIndex = 0; // Reset Monitor Records Array Index
  1456.     CurWSOp = "Delete";
  1457.     processWServicesDeleteContinue("");
  1458. }
  1459. // Get Computer and Service for each NT services Link record
  1460. function processWServicesDeleteContinue(WSDelStat) {
  1461.     var warr = new Array();
  1462.     var wstat = new Array();
  1463.     wstat = WSDelStat.split(":");
  1464.     if ( wstat[0] == "Err" ) {
  1465.         top.Rstatus.Pstat("Error deleting WinServicesWatch record: "+wstat[1],true); 
  1466.             ALupMode = "";
  1467.             PINP_Bsy = false;
  1468.             return;
  1469.     }
  1470.     while ( WSrvcsIndex < WSrvcsMonitorRecs.length-1 ) { 
  1471.         if ( RpmCC_AL.NTServicesMonitorRemove( WSrvcsMonitorRecs[WSrvcsIndex] ) ) { 
  1472.             // if unable to initiate request        
  1473.             ALupMode = "";
  1474.             PINP_Bsy = false;
  1475.             top.Rstatus.Pstat("Unable to start the WinServicesWatch DELETE request",true);
  1476.         }
  1477.         else {
  1478.             WSrvcsIndex += WSrvcsMonitorRecLength;
  1479.             ALupMode = "WinSrvcsDelete"; // Mode
  1480.             top.Rstatus.Pstat("One moment while WinServicesWatch DELETE request completes");
  1481.         }
  1482.         return;
  1483.     }
  1484.     // If Edit, now go do the Adds for current selections
  1485.     if (     CurWSOp == "Edit" ) {
  1486.         // Merege computers in CurWSCArr prior to edit with CMN_Ar after Edit
  1487.         warr = CurWSCArr.split("~");
  1488.         for ( var i=0, aix=CMN_Ar.length; i<warr.length; i++ ) {
  1489.             // check each computer from CurWSCArr against CMN_Ar
  1490.             for ( var j=0; j < CMN_Ar.length; j++ ) {
  1491.                 if ( warr[i] == CMN_Ar[j] ) {
  1492.                     break;
  1493.                 }
  1494.             }
  1495.             // Add any from CurWSCArr not in CMN_Ar
  1496.             if ( j >= CMN_Ar.length ) {
  1497.                 CMN_Ar[aix++] = warr[i];
  1498.             }
  1499.         }
  1500.         processWSMonitorAdd("");
  1501.         return;   
  1502.     }
  1503.     // otherwise Delete, finsih up
  1504.     if ( RpmCC_AL.NTServicesMonitorNotify(CurWSCArr) ) { 
  1505.         top.Rstatus.Pstat("Request to update Agents failed",true);
  1506.     }
  1507.     WinServciesMonitorLookupRequired = true; // force reread of Monitor records
  1508.     // Done deleting records, now delete AG
  1509.     if ( RpmCC_AL.AlertGroupDelete(WSAGdel) ) {
  1510.         top.Rstatus.Pstat("Unable to start the DELETE request",true);
  1511.         processResetButton();
  1512.     }
  1513.     else { // waiting for OperationCompleteEvent
  1514.         ignoreDBChangeEvent = true;
  1515.         top.Rstatus.Pstat("One moment while DELETE request completes");
  1516.     }
  1517. }
  1518.  
  1519. // Process Win Services Edit
  1520. // Expand all Groups that have Computers with selected services
  1521. var WSTEditGIxAr = new Array();
  1522. var WSTEditGIxArReclength = 5;
  1523. function processWSTEdit() {
  1524.     AL_CCOneWinServ.style.visibility = "hidden";
  1525.     var cgid = "", GObj = null;
  1526.     var warr = new Array();
  1527.     WSTEditGIxAr.length = 0;
  1528.     warr = CurWSCArr.split("~");
  1529.     for ( var i=0, GpArIx=0; i < warr.length; ++i ) { // For each computer with services
  1530.         for ( var j=0; j<AC_CompStoreArr.length; j+=CompRecLength ) {
  1531.             if ( warr[i] == AC_CompStoreArr[j] ) { // if found
  1532.                 cgid = AC_CompStoreArr[j+1]; // Group ID
  1533.                 // Now find Group in the Tree and Open it
  1534.                 for ( var k=0, l=0; k<AC_GroupStoreArr.length; k+=GroupRecLength, ++l ) {
  1535.                    if ( cgid == AC_GroupStoreArr[k+1] ) {
  1536.                        WSTEditGIxAr[GpArIx++] = j; // save this Computer's Index into CompStore
  1537.                        WSTEditGIxAr[GpArIx++] = l; // save it's associated Group index in Tree
  1538.                        GObj = document.all["lima"+l];
  1539.                         WSTEditGIxAr[GpArIx++] = ""; // reserve for Computer expand
  1540.                         WSTEditGIxAr[GpArIx++] = ""; // reserve for Computer expand
  1541.                         WSTEditGIxAr[GpArIx++] = warr[i]; // Computer ID
  1542.                           if ( GObj.expanded == "0"  ) { // expand group if necessary
  1543.                             procGrpImgClick(GObj,true);
  1544.                         }
  1545.                         break;
  1546.                     }
  1547.                 }
  1548.                 break;
  1549.             }
  1550.         }
  1551.         var CObj = document.all["zimc"+l+"_"+AC_CompStoreArr[j+5]];
  1552.        CObj.className = "optextb";
  1553.     }
  1554.     ALupMode = ""; // reset
  1555.     PopUpMoment.style.display = "none";
  1556.     AL_CCOneWinServ.style.visibility = "visible";
  1557.     return;
  1558. }
  1559.  
  1560. // Get Services Monitor Records by AGID
  1561. function processPopulateWSTComputers() {
  1562.     CommObj = RpmCC_AL;
  1563.     if ( RpmCC_AL.NTServicesMonitorLookupAGID(curAGRPID) ) { // if unable to initiate request        
  1564.         ALupMode = "";
  1565.         PINP_Bsy = false;
  1566.         top.Rstatus.Pstat("Unable to start the WinServicesWatch Server lookup request",true);
  1567.     }
  1568.     else {
  1569.         CountOfComps = CountOfCompsRcvd = 0; 
  1570.         CompIdLupArr = ""; // Computer Id Array
  1571.         ALupMode = "WSTComputerLookupPopIn"; // Mode
  1572.         top.Rstatus.Pstat("One moment while WinServicesWatch Server lookup request completes");
  1573.     }
  1574. }
  1575.  
  1576. function processWinServicesClupDone() {
  1577.     AL_Suspend.checked = (WSrvcsMonitorRecs[1] == "0") ? "checked" :"";
  1578.     AL_WSRestart.checked = (WSrvcsMonitorRecs[4] == "0") ? "checked" :"";
  1579.     warr = CompIdLupArr.split(","); // save Array of Computer IDs for this AGID
  1580.     CurWSCArr = warr.join("~");
  1581.     // Compute count of computers plus services and the display computers
  1582.     AL_CCOneWinServ.style.overflow = ( (CountOfCompsRcvd + (WSrvcsMonitorRecs.length-1)/WSrvcsMonitorRecLength) > 9 ) ? "scroll" : "";
  1583.     if ( AC_CompStoreArr.length > 0 ) { // Get computer info from local store if available
  1584.         for ( var i=0; i < warr.length; ++i ) { // For each computer with services
  1585.             for ( var j=0; j<AC_CompStoreArr.length; j+=CompRecLength ) {
  1586.                 if ( warr[i] == AC_CompStoreArr[j] ) { // if found
  1587.                    processPopulateInputComputer(AC_CompStoreArr[j+2],AC_CompStoreArr[j+3],AC_CompStoreArr[j]);
  1588.                    break;
  1589.                }
  1590.            }
  1591.        }
  1592.        processPopulateInputComplete();
  1593.     }   
  1594.     else { // otherwise read from the DB
  1595.         processPopulateCounterInputComplete()   
  1596.     }
  1597. }
  1598.  
  1599.  
  1600. var WSDs = null;
  1601. var CurExpGrpCompIx = null; // Index to Current Expanded Group/Computer
  1602. var CurWSIx = 0; // Index to current Window Service
  1603. var WSMax = 0; // Max count of services
  1604. function processWinSrvcsLookupRecord(WSLrec) {
  1605.     var WinSrvcsIDArr = new Array();
  1606.     WinSrvcsIDArr = WSLrec.split("~"); // parse the string to get the Link List services IDs
  1607.     WSDs = ""; // initialize
  1608.     CurWSIx = 0; // initialize count of services displayed
  1609.     WSMax = WinSrvcsIDArr.length-2; // set number of services
  1610.     for ( var i=1; i<WSMax; i+=2 ) {
  1611.         WSAix = GetWinServicesArrEntryIndex( parseInt(WinSrvcsIDArr[i],10) );
  1612.         SrvcType = parseInt(WinServicesArr[WSAix+3],10); // get Service type
  1613.         processWSD(WSAix,WinSrvcsIDArr[i+1],i+1,SrvcType);
  1614.     }
  1615.     var EObj = document.all["sexp"+CurExpGrpCompIx];
  1616.     EObj.insertAdjacentHTML("beforeEnd",WSDs);
  1617.     EObj.style.display = "";
  1618.     EObj.wslrec = WSLrec; // save
  1619.     EObj.srvcsdisp = CurWSIx; // save count of services displayed
  1620.     ALupMode = ""; // reset
  1621.  
  1622.     if ( ALMode == "Edit" && EObj.checkedsrvcs == 0 ) {
  1623.         var SLid, SObj;
  1624.         CObj = document.all["xima"+CurExpGrpCompIx];
  1625.         var Cid = AC_CompStoreArr[CObj.compix];    
  1626.             
  1627.           for ( i=0; i<WSrvcsLinkIDRecs.length; i+=WSrvcsLinkIDRecsLength ) {
  1628.            if (Cid != WSrvcsLinkIDRecs[i+1])
  1629.                continue;
  1630.             SLid = WSrvcsLinkIDRecs[i+2]; // Service Link ID
  1631.             for ( var k=0; k<EObj.srvcsdisp; k++ ) { // find selected service
  1632.                 SObj = document.all["wima"+CurExpGrpCompIx+"_"+k];
  1633.                 if ( SObj.slid == SLid ) {
  1634.                     if ( SObj.checked == "0" ) {
  1635.                         procWSImgClick(SObj);
  1636.                     }
  1637.                     break;
  1638.                 }
  1639.             }
  1640.         }
  1641.         EObj.checkedsrvcs = 1;        
  1642.     }
  1643. }
  1644.  
  1645. function processWSD(WSAix,SLid,SCnt,SrvcType) {
  1646.     if ( SrvcType < 16 ) { // filter out and don't display Driver services for now
  1647.         return;
  1648.     }
  1649.     var warr = new Array();
  1650.     warr = CurExpGrpCompIx.split("_");
  1651.     var Mpfx = (SCnt == WSMax) ? "L" : "T";
  1652.     var Opfx = (parseInt(warr[0],10)+1 >= GrpLupRecCount) ? "White" : "I";
  1653.     var OpSfx = (document.all["lexp"+warr[0]].compcount-1 == parseInt(warr[1],10)) ? "White" : "I";
  1654.     
  1655.     var tAGid = findAGIDFromSLID(SLid);
  1656.     var sDef = (tAGid == curAGRPID || tAGid == "0" ) ? true : false; // if AGID for this Service not found or is same as current AGID
  1657.     WSDs += "<table border='0' cellpadding='0' cellSpacing='0' width='490' >";
  1658.     WSDs += "<tr><td width='25'> </td><td width='19' height='20' align='center'><img src='images/" + Opfx + ".gif' width='19' height='20'></td>";
  1659.       WSDs += "<td width='19' align='center'><img src='images/" + OpSfx + ".gif' width='19' height='20'></td>";
  1660.     WSDs += "<td width='19' height='20' align='center'><img src='images/" + Mpfx + ".gif' width='19' height='20'></td>";
  1661.       WSDs += "<td width='11' align='center'><img id='wima" + CurExpGrpCompIx + "_" + CurWSIx;
  1662.     WSDs +=  "' checked='0' slid='" + SLid + "' src='images/"; 
  1663.     if ( sDef ) {
  1664.          WSDs += "Unchecked.gif' width='9' height='9' onclick='procWSImgClick(this)' style='cursor:hand'";
  1665.     }
  1666.     else {
  1667.         var inuse = " title='Assigned to Watch: "+getOnlyAlertName(tAGid)+"'";
  1668.          WSDs += "WinServicesInUse.gif' width='18' height='18'"+inuse;
  1669.     }
  1670.       WSDs += " checked='0'></td>";
  1671.     WSDs += "<td width='*' id='wimb" + CurExpGrpCompIx + "_" + CurWSIx;
  1672.     if ( sDef ) {
  1673.         WSDs += "' style='cursor:hand' onclick='procWSImgClick(this)' class='optext'> ";
  1674.     }
  1675.     else {
  1676.          WSDs += "' class='optext'"+inuse+"> ";
  1677.     }
  1678.     WSDs += WinServicesArr[WSAix+2] + " ("+WinServicesArr[WSAix+1]+")</td>";
  1679.     WSDs += "</tr></table>";
  1680.     ++CurWSIx; // bump index
  1681. }
  1682.  
  1683. function procWSImgClick(WSIm) {
  1684.     var isx = WSIm.id;  
  1685.     if ( isx.charAt(0) != "w" ) 
  1686.                 return;
  1687.     var cx = isx.substring(4,isx.length); // Strip off index
  1688.     lx = cx.lastIndexOf("_"); // derive suffix to the Services DIV ID
  1689.     var dx = cx.substring(0,lx);
  1690.  
  1691.     var CObj = document.all["wima"+cx]; // Clicked Checkbox Entry
  1692.     var EObj = document.all["wimb"+cx];
  1693.     var CNObj = document.all["zimc"+dx]; // computer name
  1694.     var FObj = document.all["sexp"+dx]; // Services DIV entry
  1695.  
  1696.     if ( CObj.checked == "1" ) { // if currently Checked, Uncheck
  1697.         CObj.src = "images/Unchecked.gif";
  1698.        CObj.checked = "0"; // Set Unchecked
  1699.        EObj.className = "optext";
  1700.        if ( --FObj.srvcssel == 0 ) {
  1701.              CNObj.className = "optext";
  1702.        }
  1703.       }
  1704.     else { // otherwise Check
  1705.         CObj.src = "images/Checked.gif";
  1706.           CObj.checked = "1"; // Set Checked
  1707.        EObj.className = "optextb";
  1708.        CNObj.className = "optextb";
  1709.        FObj.srvcssel++;
  1710.     }
  1711. }
  1712.  
  1713. // Get and save the list of Windows Services 
  1714. var WinServicesArr = new Array();
  1715. var WinServicesArrEntrySz = 5;
  1716. var WinServicesSortedArr = new Array();
  1717. function processWinServicesLookup(WinSvcs) {
  1718.     var wrkarr = new Array();
  1719.     WinServicesArr = WinSvcs.split("~"); // parse out the Win Services
  1720.     GetWinServicesMonitorRecords();
  1721.     var WSAmax = WinServicesArr.length - WinServicesArrEntrySz;
  1722.     for ( var i=0, j=0, k=0; i<WSAmax; i+=WinServicesArrEntrySz, k++) {
  1723.         if ( parseInt(WinServicesArr[i+3],10) < 16 )
  1724.             continue;
  1725.         // get Display Name and Service ID
  1726.         WinServicesSortedArr[j++] = WinServicesArr[i+2].toLowerCase()+"~"+k;
  1727.     }
  1728.     // Sort based on display name
  1729.     WinServicesSortedArr.sort();
  1730.     // Now parse back out the service ID and store that in the sorted array table
  1731.     for ( var k=0; k < j; k++ ) {
  1732.         wrkarr = WinServicesSortedArr[k].split("~");
  1733.         WinServicesSortedArr[k] = parseInt(wrkarr[1],10);
  1734.     }   
  1735. }
  1736.  
  1737. function GetWinServicesMonitorRecords() {
  1738.     var rstat = RpmCC_AL.NTServicesMonitorLookupAGID("0"); // Get All    
  1739.     if ( rstat ) { // if unable to initiate request        
  1740.         top.Rstatus.Pstat("Unable to start the WinServicesWatch lookup request",true);
  1741.         processResetButton();    
  1742.     }
  1743.     else { // waiting for OperationCompleteEvent
  1744.         top.Rstatus.Pstat("One moment while WinServicesWatch lookup request completes");
  1745.         WinServciesMonitorLookupRequired = false;
  1746.     }
  1747. }
  1748.  
  1749. // Get and save the list of Servcies Being Monitored
  1750. var WinServicesMonitorArr = new Array();
  1751. var WinServicesMonitorArrEntrySz = 5;
  1752. var WinServciesMonitorLookupRequired = false;
  1753. function processWinMonitoredServicesLookup(WinMonSvcs) {
  1754.     var wstat = new Array();
  1755.     wstat = WinMonSvcs.split(":");
  1756.     if ( wstat[0] == "Err" ) {
  1757.         top.Rstatus.Pstat("No WinServicesWatch records: "+wstat[1],true); 
  1758.     }
  1759.     else {
  1760.         WinServicesMonitorArr = WinMonSvcs.split("~"); // parse out the Win Services being Monitored
  1761.     }
  1762.     WinServicesLUPreqd = false;
  1763.     if ( ALupMode == "WinSrvsTreeSetup" ) {
  1764.         processWinServicesTreeContinue();
  1765.     }
  1766.     else if ( ALMode == "WinServicesLookup" ) { // if initial lookup
  1767.         GoStartIPServiceLookup(); // Go get the IP services
  1768.     }
  1769. }
  1770.  
  1771. function findAGIDFromSLID(tslid) {
  1772.     var ragid = "0"; // default not found
  1773.     for ( var i=0; i<WinServicesMonitorArr.length; i+= WinServicesMonitorArrEntrySz) {
  1774.         if ( tslid == WinServicesMonitorArr[i+2] ) {
  1775.             ragid = WinServicesMonitorArr[i+3];
  1776.             break;
  1777.         }
  1778.     }
  1779.     return ragid;
  1780. }
  1781.  
  1782. function processInclDrvr() {
  1783. }
  1784.  
  1785. var WSM_Ar = new Array(); // Array of selected services Link IDs
  1786. var CMN_Ar = new Array(); // Array of computers IDs with at least one service selected
  1787. function getCheckedSrvcsArray() {
  1788.     WSM_Ar.length = 0; // reset array
  1789.     CMN_Ar.length = 0;
  1790.     var CompCount = 0, SSel = 0, SCnt = 0, ArIx=0, CMIx = 0;
  1791.     var CObj = null, SObj = null;
  1792.     if ( document.WinSrvcRadio.AL_WinSrvcDisp[1].checked ) {
  1793.         // Find & create array of selected services Link ID
  1794.         var WSAmax = WinServicesArr.length - WinServicesArrEntrySz;
  1795.         for ( var i=0; i<WSAmax; i+=WinServicesArrEntrySz) {
  1796.             if ( parseInt(WinServicesArr[i+3],10) < 16 )
  1797.                 continue;
  1798.             SObj = document.all["wsrx"+i]; // Service Object
  1799.             EObj = document.all["wsrc"+i];
  1800.             
  1801.             if ( ALMode == "Edit" && SObj.checkedcomps != 1 ) {
  1802.                 if ( EObj.somechecked != 1 )
  1803.                     continue;
  1804.                   for ( var k=0; k < WSrvcsCompLinkIDRecs.length; k+=WSrvcsCompLinkIDRecsLength ) {
  1805.                    if (  EObj.slid == WSrvcsCompLinkIDRecs[k] ) { // Match on Servcies List ID
  1806.                         WSM_Ar[ArIx++] = WSrvcsCompLinkIDRecs[k+2]; // Service Link ID
  1807.                         CMN_Ar[CMIx++] = WSrvcsCompLinkIDRecs[k+1]; // Computer ID 
  1808.                     }
  1809.                 }                
  1810.             }            
  1811.             else {
  1812.                   CompCount = SObj.compcount; // Count of computers in this Service
  1813.                   if ( (SSel = SObj.compchkcount) == 0 ) // Count of computers selected
  1814.                       continue; // if none
  1815.                   for ( var j=0, k=0; j<CompCount && k<SSel; j++ ) { // For each Computer
  1816.                    CObj = document.all["csma"+i+"_"+j];
  1817.                    if ( CObj.checked == "1" ) { // if selected
  1818.                        CMN_Ar[CMIx++] = CObj.cid;  
  1819.                        WSM_Ar[ArIx++] = CObj.slid; 
  1820.                        ++k; // bump selected services
  1821.                       }
  1822.                 } // end check each Computer
  1823.             }            
  1824.         } // end check each Service    
  1825.     }
  1826.     else {
  1827.         // Find & create array of selected services Link ID
  1828.           for ( var i=0; i<GrpLupRecCount; ++i ) { // For Each Group
  1829.               CompCount = document.all["lexp"+i].compcount; // Count of computers in this Group
  1830.               for ( var j=0; j<CompCount; j++ ) { // For each Computer
  1831.                CObj = document.all["sexp"+i+"_"+j];
  1832.  
  1833.                 if ( ALMode == "Edit" && CObj.checkedsrvcs != 1 ) {
  1834.                     var Cix = parseInt(document.all["xima"+i+"_"+j].compix,10);                    
  1835.                     var Cid = AC_CompStoreArr[Cix];    
  1836.             
  1837.                     var fAtLeastOne = false;
  1838.                       for ( var k=0; k<WSrvcsLinkIDRecs.length; k+=WSrvcsLinkIDRecsLength ) {
  1839.                        if (Cid != WSrvcsLinkIDRecs[k+1])
  1840.                            continue;
  1841.                         WSM_Ar[ArIx++] = WSrvcsLinkIDRecs[k+2]; // Service Link ID
  1842.                         fAtLeastOne = true;
  1843.                     }
  1844.                     if ( fAtLeastOne ) {
  1845.                           CMN_Ar[CMIx++] = AC_CompStoreArr[Cix];   
  1846.                       }
  1847.                 }
  1848.                 else {
  1849.                        SSel = CObj.srvcssel; // count of selected services this computer
  1850.                    if ( SSel > 0 ) { // if at least one
  1851.                        CMN_Ar[CMIx++] = AC_CompStoreArr[ parseInt(document.all["xima"+i+"_"+j].compix,10) ];   
  1852.                       }
  1853.                    SCnt = CObj.srvcsdisp; // total count of services displayed this computer
  1854.                     for ( var k=0, l=0; k<SCnt && l<SSel; k++ ) { // For each Service
  1855.                         SObj = document.all["wima"+i+"_"+j+"_"+k];
  1856.                         if ( SObj.checked == "1" ) {
  1857.                              WSM_Ar[ArIx++] = SObj.slid; // add to array if checked
  1858.                             ++l;
  1859.                         }
  1860.                     } // end check each Service
  1861.                 }
  1862.             } // end check each Computer
  1863.         } // end check each Group    
  1864.     }    
  1865.     return ((ArIx==0) ? false : true);
  1866. }
  1867.  
  1868. function GetWinServicesArrEntryIndex(cSLid) {
  1869.     var WSAmax = WinServicesArr.length - WinServicesArrEntrySz;
  1870.     for ( var i=0; i<WSAmax; i+=WinServicesArrEntrySz) {
  1871.         if ( parseInt(WinServicesArr[i],10) == cSLid ) {
  1872.             return i;
  1873.         }
  1874.     }
  1875.     return -1
  1876. }
  1877.  
  1878.